import request from '@/utils/request'

// 查询事件列表
export function getCalendarListPage() {
  return request({
    url: '/calendar/all',
    method: 'get'
  })
}

// 删除某个事件
export function removeCalendar(role) {
  console.log(role.role)
  return request({
    url: '/calendar/remove',
    method: 'post',
    data: {
      role: role.role
    }
  })
}

// 编辑事件
export function editCalendar(data) {
  return request({
    url: '/calendar/edit',
    method: 'post',
    data: {
      description: data.description,
      role: data.newRole,
      oldRole: data.role,
      parentId: data.parentId
    }
  })
}

// 新增事件
export function addCalendar(data) {
  return request({
    url: '/calendar/add',
    method: 'post',
    data: {
      description: data.description,
      role: data.role,
      parentId: data.parentId
    }
  })
}
